package utility;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Properties;

import io.TestResourcesDirectory;

/**
 * Properties演示
 * 此演示类依赖io.characters.FileDemo类实例生成的文本文件
 * @author fidel
 */
public class PropertiesDemo {
    public static void main(String[] args) throws IOException {
        File file = new File(TestResourcesDirectory.PATH + File.separator + "CharactersFileDemo.properties");
        FileReader r = new FileReader(file);
        Properties prop = new Properties();
        prop.load(r);
        @SuppressWarnings("unchecked")
        Enumeration<String> e = (Enumeration<String>) prop.propertyNames();
        while (e.hasMoreElements()) {
            String key = e.nextElement();
            String value = (String) prop.get(key);
            System.out.println(key + "=" + value);
        }
    }
}
